<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>预测结果 - 糖尿病风险预测</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
    <div class="container">
        <header>
            <h1>糖尿病风险预测结果</h1>
        </header>

        <div class="result-container {{ result.risk_class }}">
            <div class="result-header">
                <h2>预测结果: {{ result.prediction_text }}</h2>
                <div class="probability-gauge">
                    <div class="gauge-fill" style="width: {{ result.probability * 100 }}%;"></div>
                </div>
                <p class="probability">发病概率: {{ "%.2f"|format(result.probability * 100) }}%</p>
                <p class="risk-level">风险等级: {{ result.risk_level }}</p>
            </div>

            <div class="result-details">
                <h3>患者信息</h3>
                <table>
                    <thead>
                        <tr>
                            <th>特征</th>
                            <th>数值</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for feature, value in result.patient_data.items() %}
                        <tr>
                            <td>{{ feature }}</td>
                            <td>{{ value }}</td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>

            <div class="result-notes">
                <h3>医疗建议</h3>
                {% if result.prediction == 0 %}
                <p>虽然预测结果为阴性，但请继续保持健康的生活方式。</p>
                {% else %}
                <p>预测结果显示有糖尿病风险，建议咨询医生获取专业建议。</p>
                {% endif %}
                
                <ul>
                    <li>定期监测血糖水平</li>
                    <li>维持健康的饮食习惯</li>
                    <li>保持适当的体育活动</li>
                    <li>控制体重在健康范围内</li>
                    <li>避免吸烟和过量饮酒</li>
                </ul>
                
                <p><strong>注意:</strong> 此预测结果仅供参考，不应替代专业医疗诊断。</p>
            </div>

            <div class="form-actions">
                <a href="/" class="btn-back">返回重新预测</a>
            </div>
        </div>

        <footer>
            <p>© 2023 糖尿病风险预测系统 | <a href="/feature-importance">查看特征重要性</a></p>
        </footer>
    </div>
</body>
</html> 